package com.weibo.common;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.weibo.initpage.InitPageDao;
import com.weibo.initpage.InitPageDaoImp;

public class InitPage extends BaseSeverlet  {
	private static Logger logger  = Logger.getLogger(InitPage.class);
	@Override
	public void doService(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		try {
			InitPageDao initPage = new InitPageDaoImp();
			request.setAttribute("hongrenList", initPage.getHongrenList());
			request.setAttribute("mingrenList", initPage.getMingxinList());
			Object obj = request.getParameter("type");
			if(obj!=null){
				String type = (String)obj;
				type = new String(type.getBytes("ISO-8859-1"),"UTF-8");
				if("首页".equals(type)){
					request.setAttribute("currentmenu", "首页");
					request.getRequestDispatcher("/index.jsp").forward(request, response);
				}else if("博主资源".equals(type)){
					request.setAttribute("currentmenu", "博主资源");
					request.getRequestDispatcher("/VisitorSeverlet.do").forward(request, response);
				}else if("成功案例".equals(type)){
					
				}else if("精准数据".equals(type)){
					
				}else if("专业服务".equals(type)){
					
				}else if("关于我们".equals(type)){
					
				}
			}else{
				request.setAttribute("currentmenu", "首页");
				request.getRequestDispatcher("/index.jsp").forward(request, response);
			}
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			logger.error(e);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			logger.error(e);
		}
		
	}

}
